package test;

public class Student {
    public static final String TYPE = "Java学生";
    // 属性/特征/成员变量
    private String name;
    private int age;
    private String gender;

    // 方法重载
    public Student() {
        this("无名氏", 30);
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public static void look(){
        Student student = new Student();
        student.setName("张三");
    }

    // 方法/行为/成员方法
    public void intro() {
        System.out.println(Student.TYPE);
        look();
        System.out.println("你好，我叫" + this.name + "今年" + this.age + "岁");
    }

    public String getName(){
        return this.name;
    }
    public void setName(String name){
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age >= 18 && age <= 30){
            this.age = age;
        }
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}
